import { createSlice } from '@reduxjs/toolkit'

interface CustomerServiceState {
  tickets: any[]
  knowledge: any[]
  loading: boolean
  error: string | null
}

const initialState: CustomerServiceState = {
  tickets: [],
  knowledge: [],
  loading: false,
  error: null,
}

const customerServiceSlice = createSlice({
  name: 'customerService',
  initialState,
  reducers: {
    setTickets: (state, action) => {
      state.tickets = action.payload
    },
    setKnowledge: (state, action) => {
      state.knowledge = action.payload
    },
  },
})

export const { setTickets, setKnowledge } = customerServiceSlice.actions
export default customerServiceSlice.reducer